Skip to content

DOC: improve pd.Timestamp docs with more examples and clarify differe… #18811

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 20, 2017

Conversation

mortada
Copy link
Contributor

@mortada mortada commented Dec 17, 2017

…nt forms of API usage

@mortada mortada force-pushed the pd_timestamp_docs branch 2 times, most recently from c5b149e to c6305b1 Compare December 17, 2017 05:38
@codecov
Copy link

codecov bot commented Dec 17, 2017

Codecov Report

❗ No coverage uploaded for pull request base (master@07d8c2d). Click here to learn what that means.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##             master   #18811   +/-   ##
=========================================
  Coverage          ?   91.62%           
=========================================
  Files             ?      154           
  Lines             ?    51408           
  Branches          ?        0           
=========================================
  Hits              ?    47104           
  Misses            ?     4304           
  Partials          ?        0
Flag Coverage Δ
#multiple 89.49% <ø> (?)
#single 40.83% <ø> (?)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 07d8c2d...dcdf2ab. Read the comment docs.

@gfyoung gfyoung added Docs Timezones Timezone data dtype labels Dec 17, 2017
Copy link
Contributor

@jreback jreback left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks, some comments.

unit : string
numpy unit used for conversion, if ts_input is int or float
unit : str
Unit used for conversion if ts_input is of type int or float.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's add the valid values (D, h, m, s, ms us, ns)

@@ -405,9 +406,19 @@ class Timestamp(_Timestamp):

Examples
--------
Using the primary calling convention:

>>> pd.Timestamp('2017-01-01T12')
Timestamp('2017-01-01 12:00:00')

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you add some commentary before each of these examples

@jreback jreback added this to the 0.22.0 milestone Dec 18, 2017
@mortada
Copy link
Contributor Author

mortada commented Dec 19, 2017

@jreback updated, please take a look

>>> pd.Timestamp(1513393355, unit='s', tz='US/Pacific')
Timestamp('2017-12-15 19:02:35-0800', tz='US/Pacific')

Using the other two forms that minic the API for ``datetime.datetime``:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mimic

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch, will fix

@@ -405,9 +407,23 @@ class Timestamp(_Timestamp):

Examples
--------
Using the primary calling convention:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we use this nomenclature above? if not can you reconcile

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes in the above the doc says:

    Notes
    -----
    There are essentially three calling conventions for the constructor. The
    primary form accepts four parameters. They can be passed by position or
    keyword.

    The other two forms mimic the parameters from ``datetime.datetime``. They
    can be passed by either position or keyword, but not both mixed together.

@mortada
Copy link
Contributor Author

mortada commented Dec 20, 2017

@jreback PR is updated

@jreback jreback merged commit 8e33a71 into pandas-dev:master Dec 20, 2017
@jreback
Copy link
Contributor

jreback commented Dec 20, 2017

thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Docs Timezones Timezone data dtype
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants